$(document).ready(function () {
    /*头像点击上传功能*/
    $(".my-photo img").click(function () {
        $(".my-photo input").click();
    });
    $(".my-photo input").change(function () {
        var my_photo = $(".my-photo input").val();
        $(".my-photo img").attr("src",my_photo);
    });
    /*修改个人基本信息*/
    /*修改名字*/
    $(".my-basic-information .edit-one").click(function () {
        $(this).hide();
        $(".my-name span").eq(1).hide();
        $(".my-name input").show();
        $(".my-name input").val($(".my-name span").eq(1).text());
        $(".my-basic-information .see-basic-content").hide();
        $(".my-basic-information .edit-basic-one").show();
    });
    /*修改基本信息*/
    $(".my-basic-information .btn-one button").click(function () {
        $(".my-basic-information .see-basic-content").show();
        $(".my-basic-information .edit-basic-one").hide();
        $(".my-basic-information .edit-one").show();
        $(".my-name span").eq(1).show();
        $(".my-name input").hide();
        $(".my-name span").eq(1).text($(".my-name input").val());
    });
    /*结束*/
    /*教育经历*/
    $(".my-educational-experience .edit-three").click(function () {
        var th_tt = $(this).text();
        if(th_tt=="编辑"){
            $(this).siblings(".see-educational-experience").hide();
            $(this).siblings(".edit-basic-two").show();
            $(this).siblings(".delete-div").hide();
        }else if(th_tt==""){
            $(this).parents(".anyone-educational-experience").hide();
        }
        $(this).text("");
    });

    $(".my-educational-experience .btn-two button").click(function () {
        $(this).parents(".edit-basic-two").siblings(".see-educational-experience").show();
        $(this).parents(".edit-basic-two").siblings(".edit-three").text("编辑");
        $(this).parents(".edit-basic-two").hide();
        $(this).parents(".edit-basic-two").siblings(".delete-three").show();
    });
    /*删除*/
    $(".anyone-educational-experience .delete-three").click(function(){
        $(this).parent().remove();
    });
    /*新增的功能*/
    $(".my-educational-experience .add-one").click(function () {
        $(this).before("<div style='width: 600px;height: 50px;background-color: #0e7683;margin-top: 20px;'></div>");
    });
    /*结束*/
    /*校园经历*/
    $(".my-campus-experience .edit-four").click(function () {
        var th_tt = $(this).text();
        if(th_tt=="编辑"){
            $(this).siblings(".my-experience-see").hide();
            $(this).siblings(".edit-basic-three").show();
            $(this).siblings(".delete-div").hide();
        }else if(th_tt==""){
            $(this).parents(".my-experience").hide()
        }
        $(this).text("");
    });

    $(".my-campus-experience .basic-carrier-button button").click(function () {
        $(this).parents(".edit-basic-three").siblings(".my-experience-see").show();
        $(this).parents(".edit-basic-three").siblings(".edit-four").text("编辑");
        $(this).parents(".edit-basic-three").hide();
        $(this).parents(".edit-basic-three").siblings(".delete-four").show();
    });
    /*删除*/
    $(".my-experience .delete-four").click(function(){
        $(this).parent().remove();
    });
    /*新增的功能*/
    $(".my-campus-experience .add-two").click(function () {
        $(this).before("<div style='width: 600px;height: 50px;background-color: #0e7683;margin-top: 20px;'></div>");
    });
    /*结束*/
    /*工作经历*/
    $(".my-work-experience .edit-five").click(function () {
        var th_tt = $(this).text();
        if(th_tt=="编辑"){
            $(this).siblings(".my-experience-see").hide();
            $(this).siblings(".edit-basic-four").show();
            $(this).siblings(".delete-div").hide();
        }else if(th_tt==""){
            $(this).parents(".my-experience").remove();
        }
        $(this).text("");
    });

    $(".my-work-experience .basic-carrier-button button").click(function () {
        $(this).parents(".edit-basic-four").siblings(".my-experience-see").show();
        $(this).parents(".edit-basic-four").siblings(".edit-five").text("编辑");
        $(this).parents(".edit-basic-four").hide();
        $(this).parents(".edit-basic-four").siblings(".delete-five").show();
    });
    /*新增的功能*/
    $(".my-work-experience .add-three").click(function () {
        $(this).before();
    });
    /*删除*/
    $(".my-experience .delete-five").click(function(){
        $(this).parent().remove();
    });
    /*结束*/

    /*简历导航的定位效果*/
    var w = $(window).outerHeight();
    var wwindow = $(window);
    wwindow.scroll(function () {
        var scrollHeight = wwindow.scrollTop();
        if(scrollHeight > 120) {
            $(".navigation-list").addClass("pst-f");
            $(".navigation-list").removeClass("pst-r");
        }else  if(scrollHeight <=120){
            $(".navigation-list").addClass("pst-r");
            $(".navigation-list").removeClass("pst-f");
        }
    });

    /*简历导航项的点击效果*/
    $(".navigation-list li").click(function () {
        $(this).addClass("navigation-list-color");
        $(this).siblings().removeClass("navigation-list-color");
    });

    /*简历导航项的滚动效果*/
    $(window).scroll(function () {
        var new_sh = $(window).scrollTop();
        var b2 = $("#my-educational-experience").offset().top;
        var b3 = $("#my-campus-experience").offset().top;
        var b4 = $("#my-work-experience").offset().top;
        if(new_sh<=b2){
            $(".navigation-list li").eq(0).addClass("navigation-list-color");
            $(".navigation-list li").eq(0).siblings().removeClass("navigation-list-color");
        }else if(new_sh>b2&&new_sh<=b3){
            $(".navigation-list li").eq(1).addClass("navigation-list-color");
            $(".navigation-list li").eq(1).siblings().removeClass("navigation-list-color");
        }else if(new_sh>b3&&new_sh<=b4){
            $(".navigation-list li").eq(2).addClass("navigation-list-color");
            $(".navigation-list li").eq(2).siblings().removeClass("navigation-list-color");
        }else if (new_sh>b4) {
            $(".navigation-list li").eq(3).addClass("navigation-list-color");
            $(".navigation-list li").eq(3).siblings().removeClass("navigation-list-color");
        }
    });
});